package day07;

import java.util.Scanner;

public class CalTotalAvg2 {
    public static void main(String[] args) {
       int [] s = arrAdd();
       int x = sun(s);
       int avg = avg(s);
        System.out.println("平均分"+avg);
    }
    public static int[] arrAdd(){
        Scanner scanner = new Scanner(System.in);
        int[] array  = new int[6];
            for (int i = 0;i<array.length;i++){
                System.out.println("请输入第"+(i+1)+"个评委的分数");
                array[i] = scanner.nextInt();
            }
        return array;
    }
    public static int sun(int[] arr){
        int x = 0;
        int max = arr[0];
        int min = arr[0];
        for (int i=0;i<arr.length;i++){
            if (max>arr[i]){
                max = arr[i];
            }
            if (min<arr[i]){
                min = arr[i];
            }
            x += arr[i];
        }
        return x-max-min;
    }
    public static int avg(int[] a){
       int d = sun(a);
       return d/( a.length-2);
    }
}
